/*********************************************************************
	Name: debug_led.c         
	Description: 	Controls debugging LEDs.
			Initialise ports and turn LEDs ON and off.
			
	Author: Andrew Nicholas
	Date: 9/08/2011
*********************************************************************/

#include <p30f3013.h>
#include "debug_led.h"
#include "type.h"

#define   YELLOW_LED 	_LATB7
#define   GREEN_LED		_LATB9

#define   YELLOW_LED_DDR	_TRISB7
#define   GREEN_LED_DDR	_TRISB9

/*****************************************************************************
** Function name:		led_init
**
** Descriptions:		Initalise debug LEDs
**
** parameters:		None
** Returned value:		None
**
*****************************************************************************/
 void led_init(){
	 
	 // Set DDR to output (0)
	 YELLOW_LED_DDR = 0	;
	 GREEN_LED_DDR  = 0 ;
	 
	 // Set LEDs to OFF
	 YELLOW_LED	 = 0;
	 GREEN_LED	 = 0;
 }
 
 /*****************************************************************************
** Function name:		led_yellow_on
**
** Descriptions:		Turn yellow LED ON
**
** parameters:		None
** Returned value:		None
**
*****************************************************************************/
 void led_yellow_on(){
	 YELLOW_LED	 = 1;
 }
 /*****************************************************************************
** Function name:		led_yellow_off
**
** Descriptions:		Turn yellow LED ON
**
** parameters:		    None
** Returned value:		None
**
*****************************************************************************/
 void led_yellow_off(){
	 YELLOW_LED	 = 0;
 }

 /*****************************************************************************
** Function name:		led_yellow_toggle
**
** Descriptions:		Toggle yellow LED
**
** parameters:	    	None
** Returned value:		None
**
*****************************************************************************/
void led_yellow_toggle(){
	~YELLOW_LED;
}
 /*****************************************************************************
** Function name:		led_green_on
**
** Descriptions:		Turn green LED ON
**
** parameters:		None
** Returned value:		None
**
*****************************************************************************/
 void led_green_on(){
	  GREEN_LED	 = 1;
	 
 }
 /*****************************************************************************
** Function name:		led_green_off
**
** Descriptions:		Turn green LED OFF
**
** parameters:		None
** Returned value:		None
**
*****************************************************************************/
 void led_green_off(){
	  GREEN_LED	 = 0;
 }
